Skip to content

View JSON pages: bundle the JSON / JSON-LD viewer, off by default - #49

Merged
jjohare merged 3 commits into
mainfrom
json-viewer
Nov 29, 2026
Merged

jjohare merged 3 commits into
mainfrom
json-viewer

Conversation

@melvincarvalho

@melvincarvalho melvincarvalho commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Closes #48.

Adds a setting, View JSON pages, to the popup. Off by default. When on, a page that is a JSON, JSON-LD or JSON Lines response is shown as a collapsible tree with a table view, search, type badges and followable @id links, and a Viewer / Raw switch.

How it is built in

  • One vendored file. vendor/json-viewer/json-viewer.js comes from solid-panes/json at a pinned commit, recorded with its SHA-256 in PINS.json; scripts/vendor-json-viewer.js refreshes it and a test checks the tree against the pin, the same way as vendor/sidestr/.
  • Registered only while on. src/content-scripts.js gains one optional script, podkey-json-viewer, beside the three existing ones. With the setting off it is unregistered, so the viewer's code runs on no page. A site Podkey is switched off for leaves it out like the others.
  • Nothing new in the manifest. No permission, no static content script, no web-accessible resource.
  • Kept away from the key. The viewer uses no extension API, reads no storage, sends no messages and makes no network requests; it reads the text the browser already has. The line that starts it (src/json-viewer-start.js) touches neither chrome.runtime nor the bridge. It leaves the isolated world's fetch and other globals alone and adds one name, SolidJsonViewer.

Checked

  • npm test: 483 pass (16 new), npm run lint clean, npm run build runs.
  • In headless Chromium with the unpacked extension: off by default (three scripts registered, JSON pages untouched); on (JSON pages shown, including under a strict page CSP; ordinary pages left alone; window.nostr still present; no added requests); off again (script removed, pages untouched); the popup shows the toggle unchecked. 30 of 30.

Not in this pull request

  • The SolidOS panes viewer (loading SolidOS panes, an RDF store, the SolidOS frame) is a separate piece of work. We may look at it in the future.
  • No version bump.
  • store/SUBMISSION.md is unchanged. It describes Podkey as a key signer with "no bundled unrelated features". If this is merged, that text and the store listing need a decision before the next store submission (see Bundle the JSON / JSON-LD viewer (off by default) #48).

To consider in review

All of an extension's content scripts share one isolated world per page, so while the setting is on the viewer runs beside the bridge. It parses untrusted page text. The mitigations here are: off by default, unregistered when off, nothing on non-JSON pages, no extension API in the viewer, and tests that fail if the vendored file gains chrome., a dynamic import, eval or a fetch replacement.

The viewer is one vendored file from solid-panes/extension, pinned in
vendor/json-viewer/PINS.json. Its content script is registered only while
the setting is on, in src/content-scripts.js beside the other three, so a
switched-off site leaves it out too. No new permission, no web-accessible
resource, no storage access from the page side, no network requests.

The full SolidOS panes viewer is separate and not part of this.
@jjohare
jjohare merged commit 3b30099 into main Nov 29, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bundle the JSON / JSON-LD viewer (off by default)

2 participants